<?php

    $status = (null) ? 'closed' : 'open';
    $url = 'index.php?dir=' . $dir . '&sub=' . $sub;
    
    if ($vendors) {
	
	echo '<h4 class="' . $status . '" onclick="swap(this);">Vendors (' . sizeof($vendors) . ')</h4>';
	echo '<div>';
        echo '<table><tbody>';
        
        echo '<tr><th>#</th><th>ID</th><th>Title</th>th>Address</th><th>Task(s)</th><th>Contact</th><th>Phone</th></tr>';
	
        foreach ($vendors as $i=>$vendor) {
            $contact = $vendor->getContact();
            $contactName = $contact->getFullName();
            $contactPhone = $contact->getPhone()->getNumber();
            echo '<tr>';
            echo '<td>' . $i . '</td>';
            echo '<td>' . $vendor->getId() . '</td>';
            echo '<td>' . $vendor->getTitle() . '</td>';
            echo '<td>' . $vendor->getAddress() . '</td>';
            echo '<td>' . $vendor->getTaskCount() . '</td>';
            echo '<td>' . $contactName . '</td>';
            echo '<td>' . $contactPhone . '</td>';
            
            echo '</tr>';
        }
        echo '</tbody></table>';
        
    } else {
	
	echo '<h4>There are no Polls!</h4>';
	echo '<div>';

    }
    echo '</div>';
    echo '<button class="create" onclick="window.location="' . $url . '&act=edit">Add Poll</button>';
    
?>